#ifndef UTILS_H
#define UTILS_H

#include <cstddef>
#include <string>

// Safe calloc wrapper (checks for overflow)
void *ecalloc(size_t nmemb, size_t size);

// Decode UTF-8 character (returns byte count)
int utf8Decode(const char *s_in, long *out_char, int *out_err);
size_t nextrune(size_t pos, int dir);
// Read stdin into menu items
void readStdin();

// Filter items to match user input
void filterMatches();

// Calculate visible item pages
void calcOffsets();

// Cleanup all resources
void cleanup();

#endif // UTILS_H
